import config from "@/utils/config.js"
//退出
const quit = async (token) => {
	let url = config.baseUrl + "wx/user/loginout";
	let param = {
		token: token,
	}
	let res = await config.getData(url, param);
	return res;
}

//获取入站车辆数据
const getInStationCar = async (obj) => {
	let url = config.baseUrl + "wx/busi/taskstationvechicles";
	let param = {
		stationId: obj.stationId,
		token: obj.token,
		userId: obj.userId,
		vehicleCode: obj.vehicleCode || '',
		driverName: obj.driverName || '',
		getType: obj.getType || '',
		lineName: obj.lineName || '',
		plateNumber: obj.plateNumber || '',
		vehicleCode: obj.vehicleCode || '',
	}
	let res = await config.getData(url, param);
	return res;
}

//获取已作业数据
const getOperatorData = async (obj) => {
	let url = config.baseUrl + "wx/busi/usertodaystationcheck";
	let param = {
		getType: obj.getType,
		stationId: obj.stationId,
		token: obj.token,
		userId: obj.userId,
	}
	let res = await config.getData(url, param);
	return res;
}

//获取指定日期历史排班
const getHistoryOrders = async (taskDate, token) => {
	let url = config.baseUrl + "wx/driver/datetask";
	let param = {
		taskDate: taskDate,
		token: token,
	}
	let res = await config.getData(url, param);
	return res;
}

//根据id获取站点详情
const getSpotDetail = async (id, token) => {
	let url = config.baseUrl + "wx/query/taskstationinfo";
	let param = {
		id: id,
		token: token,
	}
	let res = await config.getData(url, param);
	return res;
}

//获取站点列表
const getSpotList = async (getpoints, token) => {
	let url = config.baseUrl + "wx/query/getstationlist";
	let param = {
		getpoints: getpoints,
		token: token,
	}
	let res = await config.getData(url, param);
	return res;
}

export default {
	quit,
	getInStationCar,
	getOperatorData,
	getHistoryOrders,
	getSpotDetail,
	getSpotList
}